export const getQueryParameters = (req) => {
  const url = new URL(req.url, 'http://localhost')
  const params = {}
  for (const [key, value] of url.searchParams) {
    params[key] = value
  }
  return params
}

export const responseSuccess = (data, message = 'success') => {
  return {
    code: 200,
    data,
    message
  }
}

export const responseError = (message = 'error', code = 500) => {
  return {
    code,
    message
  }
}